# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html


# useful for handling different item types with a single interface
from itemadapter import ItemAdapter


# class AcmScore(db.Model):
#     __bind_key__ = "User"
#     QQ = db.Column(db.String)
#     Year = db.Column(db.String)
#     user_name = db.Column(db.String)
#     cf_name = db.Column(db.String)
#     cf_data = db.Column(db.String)
#     nk_name = db.Column(db.String)
#     nk_data = db.Column(db.String)
#     at_name = db.Column(db.String)
#     at_data = db.Column(db.String)


# PipeLine常见用途
# 验证爬取的数据(检查item包含某些字段，比如说name字段)
# 查重(并丢弃)
# 将爬取结果保存到文件或者数据库中

class AtcoderPipeline:
    def process_item(self, item, spider):
        print("item", item)
        return item


class CodeforcesPipeline:  # 不同item使用isinstance区分
    def process_item(self, item, spider):
        return item


class NowcoderPipeline:
    def process_item(self, item, spider):
        print("item", item)
        return item


class LuoguPipeline:
    def process_item(self, item, spider):
        print("item", item)
        return item


class VjudgePipeline:
    def process_item(self, item, spider):
        print("item", item)
        return item

class DefaultPipeline():
    def process_item(self, item, spider):
        print("item", item)
        return item